package com.newly.common.base.exception;

/**
 * @author gjm guan
 * @date 2021/7/28 10:33
 * @desc 处理全局运行时异常
 */
public class NewlyException extends RuntimeException{
    /**
     * 状态码
     */
    private Integer code;
    /**
     * 错误消息
     */
    private String errMsg;
    /**
     * 数据
     */
    private Object data;

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }


    public NewlyException(String message) {
        this(500,message,null);
    }

    public NewlyException(int code, String message) {
        this(code,message,null);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getErrMsg() {
        return errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }

    public NewlyException(int  code, String errMsg, Object data) {
        this.code = code;
        this.errMsg = errMsg;
        this.data = data;
    }

    public NewlyException(String message, Throwable cause) {
        super(message, cause);
    }

    public NewlyException(Throwable cause) {
        super(cause);
    }

    public NewlyException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }
}
